<template>
<div>
  <div style="width: 1220px;height: 30px">
    <van-button style="font-size: 20px;float: left;height: 30px" v-if="id">您好,{{username}}</van-button>
    <van-button style="font-size: 20px;float: left;height: 30px" v-else @click="to">亲,请登录</van-button>


    <div style="width: 650px;height: 30px;float: left"></div>
    <van-button style="font-size: 20px;float: left;height: 30px" @click="to_hone">首页</van-button>

    <van-button style="font-size: 20px;float: left;height: 30px" @click="to_ger">个人中心</van-button>
    <van-button style="font-size: 20px;float: left;height: 30px" @click="tu_reg">免费注册</van-button>
    <van-button style="font-size: 20px;float: left;height: 30px" @click="remove_log">退出</van-button>

  </div>
</div>
</template>

<script>
export default {
name: "Navigation_bar",
  data(){
  return{
    id:localStorage.getItem('usrid'),
  username:localStorage.getItem('username')
  }
  },
  mounted() {
  },
  methods:{
    remove_log(){
      localStorage.removeItem('usrid')
      localStorage.removeItem('username')
      localStorage.removeItem('token')
      window.location.href='/login'
    },
    go_home_page(){

    },
    to(){
      window.location.href='/login'
    } ,to_hone(){
      this.$emit('id',80)
    } ,to_ger(){
      window.location.href='/personal_center'
    },tu_reg(){
      window.location.href='/reg'
    }
  },
}
</script>

<style scoped>

</style>

